package cn.fzkj.gulimall.controller;

import cn.fzkj.gulimall.service.MallSearchService;
import cn.fzkj.gulimall.vo.SearchParam;
import cn.fzkj.gulimall.vo.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @DESCRIPTION 检索入口
 * @Author yaya
 * @DATE 2022/6/11
 */
@Controller
public class SearchController {

    @Autowired
    MallSearchService mallSearchService;

    // 跳转到list.html
    @RequestMapping(value = "list.html")
    public String listPage(SearchParam param, Model model){

        SearchResult result = mallSearchService.search(param);
        model.addAttribute("result", result);
        return "list";
    }
}
